import { http } from "@/utils/http";
export interface QueryEnumsRes {
  data: Record<string, unknown>;
  total: number;
}
// 查询值班日历信息接口
export const dutyQuery = (data?: Record<string, any>): Promise<QueryEnumsRes> => {
  return http.request("post", "/erc/api/v1/duty/query", {
    data
  });
};

// 新增值班日历接口
export const dutycreate = (data?: Record<string, any>) => {
  return http.request("post", "/erc/api/v1/duty/create", {
    data
  });
};
// 更新值班日历接口
export const dutyUpdate = (data?: Record<string, any>) => {
  return http.request("post", "/erc/api/v1/duty/update", {
    data
  });
};
// 获取枚举数据接口
export const dutyEnumQuery = () => {
  return http.request("get", "/erc/api/v1/duty/enum/query");
};
/**
 * 查询值班日历详情接口
 * @param {object} params QueryDutyDetailDTO
 * @param {string} params.factoryId 地块
 * @param {number} params.pageNum
 * @param {number} params.pageSize
 * @param {string} params.orderByColumn
 * @param {string} params.isAsc
 * @param {number} params.dutyTableId 值班日历ID
 * @param {string} params.dutyType 班别：DA - 白班；DB - 夜班
 * @param {object} params.startTime 查询开始时间
 * @param {object} params.endTime 查询结束时间
 * @param {string} params.orderBy
 * @returns
 */
export function queryDetail(data) {
  return http.post(`/erc/api/v1/duty/detail/query`, { data });
}
/**
 * 下载值班日历模板
 * @returns
 */
export function downloadTemplate() {
  return http.get(`/erc/api/v1/duty/template/download`);
}
/**
 * 导入值班日历
 * @param {string} data
 * @returns
 */
export function importDuty(data: object) {
  return http.request(
    "post",
    `/erc/api/v1/duty/import`,
    {
      data
    },
    {
      headers: {
        noLoading: true,
        "content-type": "application/x-www-form-urlencoded"
      }
    }
  );
}
